<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Building with multiple versions of Berkeley DB</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Installation and Build Guide" />
    <link rel="up" href="install.html" title="Chapter 2.  System Installation Notes" />
    <link rel="prev" href="install.html" title="Chapter 2.  System Installation Notes" />
    <link rel="next" href="debug.html" title="Chapter 3.  Debugging Applications" />
  </head>
  <body>
    <div xmlns="" class="navheader">
      <div class="libver">
        <p>Library Version 12.1.6.2</p>
      </div>
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Building with multiple versions of Berkeley DB</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="install.html">Prev</a> </td>
          <th width="60%" align="center">Chapter 2.  System Installation Notes </th>
          <td width="20%" align="right"> <a accesskey="n" href="debug.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="sect1" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title" style="clear: both"><a id="install_multiple"></a>Building with multiple versions of Berkeley DB</h2>
          </div>
        </div>
      </div>
      <p>
        In some cases it may be necessary to build applications
        which include multiple versions of Berkeley DB. Examples
        include applications which include software from other
        vendors, or applications running on a system where the system
        C library itself uses Berkeley DB. In such cases, the two
        versions of Berkeley DB may be incompatible, that is, they may
        have different external and internal interfaces, and may even
        have different underlying database formats.
    </p>
      <p>
        To create a Berkeley DB library whose symbols won't collide
        with other Berkeley DB libraries (or other application or
        library modules, for that matter), configure Berkeley DB using
        the <a class="link" href="build_unix_conf.html#build_unix_conf.--with-uniquename=NAME">--with-uniquename=NAME</a> 
        configuration option, and
        then build Berkeley DB as usual. (Note that <a class="link" href="build_unix_conf.html#build_unix_conf.--with-uniquename=NAME">--with-uniquename=NAME</a> 
        only affects the Berkeley DB C language library build; loading multiple versions of the
        C++ or Java APIs will require additional work.) The modified
        symbol names are hidden from the application in the Berkeley
        DB header files, that is, there is no need for the application
        to be aware that it is using a special library build as long
        as it includes the appropriate Berkeley DB header file.
    </p>
      <p>
        If "NAME" is not specified when configuring with <a class="link" href="build_unix_conf.html#build_unix_conf.--with-uniquename=NAME">--with-uniquename=NAME</a>, 
        a default value built from the major and minor numbers of the Berkeley DB 
        release will be used. It is rarely necessary to specify NAME; using the major
        and minor release numbers will ensure that only one copy of
        the library will be loaded into the application unless two
        distinct versions really are necessary.
    </p>
      <p>
        When distributing any library software that uses Berkeley
        DB, or any software which will be recompiled by users for
        their systems, we recommend two things: First, include the
        Berkeley DB release as part of your release. This will
        insulate your software from potential Berkeley DB API changes
        as well as simplifying your coding because you will only have
        to code to a single version of the Berkeley DB API instead of
        adapting at compile time to whatever version of Berkeley DB
        happens to be installed on the target system. Second, use
        <a class="link" href="build_unix_conf.html#build_unix_conf.--with-uniquename=NAME">--with-uniquename=NAME</a> 
        when configuring Berkeley DB, because that will insure that you do
        not unexpectedly collide with other application code or a library already
        installed on the target system.
    </p>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="install.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="install.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="debug.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Chapter 2.  System Installation Notes  </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Chapter 3.  Debugging Applications </td>
        </tr>
      </table>
    </div>
  </body>
</html>
